package com.study.juc.cf;

import java.util.concurrent.CompletableFuture;

/**
 * @program: juc-study
 * @author: jzhou
 * @date: 2022-08-11 23:18
 * @version: 1.0
 * @description: 消费方法对比
 **/
public class CompletableFutureAPIDemo {
    public static void main(String[] args) {
        System.out.println(CompletableFuture.supplyAsync(() -> "resultA").thenRun(() -> {}).join());
        System.out.println(CompletableFuture.supplyAsync(() -> "resultA").thenAccept(System.out::println).join());
        System.out.println(CompletableFuture.supplyAsync(() -> "resultA").thenApply(resultA -> resultA + " resultB").join());
    }
}
